function beginConversation() {
    $(".beginConv").click(function () {
        console.log("dadas");
        var textarea = $(this).parent().find("textarea");
        var message = textarea.val();
        var topic = $(this).parent().children("div").children("input").val();
        var customerID = $(this).parent().children(".customerID").val();
        var shopID = $("#shopID").val();
        var data = {
            message: message,
            topic: topic,
            customer: customerID,
            shop: shopID
        };
        $.ajax({
            type: "POST",
            url: "/ajax/beginConvAsSeller",
            dataType: "json",
            data: data,
            success: function (json) {
                window.location.href = window.location.href;
                // textarea.text("");
            },
            error: function (data) {
                //  console.log(data.responseText);
            }
        });
    });
}
$(document).ready(function () {
    $(".AddDiscount").click(function () {
         $(this).next().removeClass("hidden");
        var discountVal = $(this).parent().children(".discountVal").val();
        var customerID = $(this).parent().children(".customerID").val();
        var data = {
            discountVal: discountVal,
            customer: customerID
        };
        $.ajax({
            type: "POST",
            url: "/ajax/updateDiscount",
            dataType: "json",
            data: data,
            success: function (json) {
                //window.location.href = window.location.href;
                // textarea.text("");
            },
            error: function (data) {
                  console.log(data.responseText);
            }
        });
    });
    $(".showOptions").click(function () {
        $(this).next().toggleClass("hidden");
    });
    $(".showMessage").click(function () {
        $(this).parent().parent().parent().next("tr.Message").toggleClass("hidden");
    });
    $(".showLog").click(function () {
        $(this).parent().parent().parent().next().next("tr.LogLogin").toggleClass("hidden");
    });
    $(".showComments").click(function () {
        $(this).parent().parent().parent().next().next().next("tr.Comments").toggleClass("hidden");
    });
    $(".showBuy").click(function () {
        $(this).parent().parent().parent().next().next().next().next("tr.BoughtProducts").toggleClass("hidden");
    });
    $(".showAdress").click(function () {
        $(this).parent().parent().parent().next().next().next().next().next("tr.Address").toggleClass("hidden");
    });
    $(".showDiscount").click(function () {
        $(this).parent().parent().parent().next().next().next().next().next().next("tr.Discount").toggleClass("hidden");
    });
    beginConversation();
});